package com.blb.socket;

import java.io.DataInputStream;
import java.io.IOException;

/**
 * 处理读任务的线程
 */
public class ReadTask implements Runnable {

    private DataInputStream in;

    public ReadTask(DataInputStream in) {
        this.in = in;
    }

    @Override
    public void run() {
        try {
            //不断的读取数据
            for(;;){
                String s = in.readUTF();
                System.out.println("对方说：" + s);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
